import request from '@/utils/request'

export function getAllSections() {
  return request({
    url: '/community/help/sections',
    method: 'get'
  })
}

export function getAllVotes(query) {
  return request({
    url: '/community/help/votes',
    method: 'get',
    params: query
  })
}

export function getVoteById(id) {
  return request({
    url: '/community/help/vote/' + id,
    method: 'get'
  })
}

export function deleteHelpVoteById(id) {
  return request({
    url: '/community/help/vote/' + id,
    method: 'delete'
  })
}

export function updateVoteContent(vote) {
  return request({
    url: '/community/help/vote',
    method: 'put',
    data: vote
  })
}

export function addVote(voteWhole) {
  return request({
    url: '/community/help/vote',
    method: 'post',
    data: voteWhole
  })
}

export function getVoteResultsById(id) {
  return request({
    url: '/community/help/voteResults/' + id,
    method: 'get'
  })
}

export function getVoteCommentsById(id) {
  return request({
    url: '/community/help/voteComments/' + id,
    method: 'get'
  })
}

export function addVoteComment1(voteComment1) {
  return request({
    url: '/community/help/voteComment1',
    method: 'post',
    data: voteComment1
  })
}

export function addVoteComment2(voteComment2) {
  return request({
    url: '/community/help/voteComment2',
    method: 'post',
    data: voteComment2
  })
}

export function deleteVoteComment1ById(id) {
  return request({
    url: '/community/help/voteComment1/' + id,
    method: 'delete'
  })
}

export function deleteVoteComment2ById(id) {
  return request({
    url: '/community/help/voteComment2/' + id,
    method: 'delete'
  })
}
